package com.synjones.handsetS8.ild.base;

import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * @author Chris Chan
 * Create on: 2021/7/15}11:10
 * For: 封装
 * Explain:
 */
public abstract class BaseRecyclerHolder<D> extends RecyclerView.ViewHolder {
    protected View itemView;
    protected Context context;

    public BaseRecyclerHolder(Context context, View itemView) {
        super(itemView);
        this.context = context;
        this.itemView = itemView;
    }

    /**
     * 更新视图
     *
     * @param item
     */
    public abstract void refreshView(D item);

    /**
     * 更新视图
     * 带着集合元素下标
     *
     * @param item
     * @param position
     */
    protected void refreshView(D item, int position) {
    }

    /**
     * 更新视图
     * 带着集合元素下标和BaseActivity
     * 用于列表项目控件内部控件处理跳转
     *
     * @param activity
     * @param item
     * @param position
     */
    protected void refreshView(Activity activity, D item, int position) {
    }
}
